package com.wxmit.base.enums;


import lombok.experimental.FieldNameConstants;

import java.util.*;

/**
 * @author xiongchuyun
 * @date 2022/8/17 10:42
 *  系统(0、1)枚举 包括:系统是否，状态，性别
 */
@FieldNameConstants
public enum YesOrNoEnum {
    YES("0","是","y","启用","男"),
    NO("1","否","n","禁用","女");

    public String code;
    public String name;
    public String dictValue;
    public String statusLabel;
    public String genderLabel;


    YesOrNoEnum(String code,String name, String dictValue,String statusLabel,String genderLabel) {
        this.code = code;
        this.name = name;
        this.dictValue = dictValue;
        this.statusLabel = statusLabel;
        this.genderLabel = genderLabel;
    }

    public static List<Map<String,String>> getEnums(){
        List<Map<String,String>> list = new ArrayList<>(2);

        for (YesOrNoEnum value : values()) {
            Map<String, String> map = new HashMap<>(5);
            map.put(Fields.code,value.code);
            map.put(Fields.name,value.name);
            map.put(Fields.dictValue,value.dictValue);
            map.put(Fields.statusLabel,value.statusLabel);
            map.put(Fields.genderLabel,value.genderLabel);
            list.add(map);
        }
        return list;
    }

    public Boolean eqCode(String code){
        return Objects.equals(this.code,code);
    }

}

